﻿@model GolfLeague.EditModels.HandicapEditModel

@{
    ViewBag.Title = "Player Handicaps";
}

<fieldset>
    <legend>Player Handicaps</legend>
    <table>
        <tr>
            <th rowspan="2" valign="bottom">Player Name</th>
            <th rowspan="2" valign="bottom" style="text-align:center">Team #</th>
            <th colspan="2" style="text-align:center">Handicaps</th>
            <th rowspan="2" valign="bottom" style="text-align:center">Last<br />Updated</th>
            <th rowspan="2" valign="bottom" style="text-align:center"># of<br />Rounds Used</th>
        </tr>
        <tr>
            <th style="text-align:center">Previous</th>
            <th style="text-align:center">Current</th>
        </tr>

    @foreach (var item in Model.Players.OrderBy(p => p.CurrentHandicap.Player.LastName)) {
        <tr>
            <td>
                @item.CurrentHandicap.Player.FirstName[0]. @item.CurrentHandicap.Player.LastName
            </td>
            <td style="text-align:center">
                @item.TeamID
            </td>
            <td style="text-align:center">
                @if(item.PreviousHandicap < 0) {
                    @Html.Raw("N/A")
                }
                else
                {
                    @item.PreviousHandicap
                }
            </td>
            <td style="text-align:center">
                @item.CurrentHandicap.Handicap
            </td>
            <td>
                @String.Format("{0:MM/dd/yyyy}", item.CurrentHandicap.CreatedOn)
            </td>
            <td style="text-align:center">
                @item.CurrentHandicap.PreviousRoundsUsed
            </td>
        </tr>
    }

    </table>
</fieldset>